package com.common.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

public class ClientRequests {

	/**
	 * 获取客户端请求
	 * @return
	 */
	public static HttpServletRequest get(){
		ServletRequestAttributes requestAttributes=(ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
		return requestAttributes.getRequest();
	}
	
	public static HttpSession getSession(){
		HttpServletRequest request=get();
		return request.getSession();
	}
}
